<template>
  <div class="title-container">
    <span class="title">{{ titleName }}</span>
    <div class="icon" :style="iconStyle">
      {{ iconName }}
    </div>
  </div>
</template>

<script>
export default {
  props: {
    titleName: {
      type: String,
      default: 'BP计划-发起',
    },
    iconName: {
      type: String,
      default: 'New',
    },
    color: {
      type: String,
      default: 'red',
    },
  },
  computed: {
    iconStyle() {
      const options = {
        red: {
          color: '#f10000',
          border: '1px solid #f10000',
          background: '#FFEAEA',
        },
        blue: {
          color: '#7BBFFF',
          border: '1px solid #7BBFFF',
          background: '#E0F0FF',
        },
        green: {
          color: '#09A120',
          border: '1px solid #09A120',
          background: '#E7FFEA',
        },
      };
      return options[this.color] || options['red'];
    },
  },
};
</script>

<style lang="less" scoped>
.title-container {
  border-bottom: 1px solid #e5e6e9;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  .title {
    font-size: 16px;
    color: #040c2c;
    font-weight: 500;
  }
  .icon {
    margin-left: 6px;
    font-size: 12px;

    height: 22px;
    padding: 0 10px;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
  }
}
</style>
